<!DOCTYPE html>
<html>
<head lang="en">
	<title>登录页 如梦技术——JFinal2.0 极速开发</title>
	<% include("include/_mate.html") {} %>
	<style>
		.header {
			text-align: center;
		}
		.header h1 {
			font-size: 200%;
			color: #333;
			margin-top: 30px;
		}
		.header p {
			font-size: 14px;
		}
		.blog-footer {
			padding: 10px 0;
			text-align: center;
		}
	</style>
</head>
<body>
<div class="header">
	<div class="am-g">
		<h1>如梦技术——<small>JFinal2.0 极速开发</small></h1>
	</div>
	<hr />
</div>
<div class="am-g">
	<div class="am-u-lg-6 am-u-md-8 am-u-sm-centered">
		<h3>登录</h3>
		<hr>
		<form method="post" action="${ctxPath}/ajax/session" class="am-form" data-am-validator>
			<div class="am-input-group">
				<span class="am-input-group-label"><i class="am-icon-envelope-o am-icon-fw"></i></span>
				<input type="email" name="email" class="am-form-field" placeholder="邮箱" required>
			</div>
			<br>
			<div class="am-input-group">
				<span class="am-input-group-label"><i class="am-icon-lock am-icon-fw"></i></span>
				<input type="password" name="password" class="am-form-field" placeholder="密码" required>
			</div>
			<br>
			<label for="remember-me">
				<input id="remember-me" name="remember" value="1" type="checkbox" checked> 记住密码
			</label>
			<br />
			<div class="am-cf">
				<input type="submit" value="登 录" class="am-btn am-btn-primary am-btn-sm am-btn-block am-fl">
			</div>
			<div class="am-cf">
				<a href="${ctxPath}/register?from=${c.encodeUrl(from)}" class="am-fl">免费注册</a>
				<a href="${ctxPath}" class="am-fr">忘记密码 ^_^ ?</a>
			</div>
		</form>
	</div>
</div>

<footer class="blog-footer">
  <p>blog template<br/>
    <small>© Copyright XXX. by the AmazeUI Team.</small>
  </p>
</footer>

<% include("include/_script.html") {} %>
<script type="text/javascript">
$(function(){
	$("form").submit(function(){
		var $form = $(this);
		$.post($form.attr("action"), $form.serialize(), function(data){
			if (data.code === 0) {
				layer.msg("登录成功", {shift: 1});
				setTimeout(function(){window.location.href = "${ctxPath}${from}";}, 1200);
				return false;
			} else {
				layer.msg(data.message, {shift: 6});
				return false;
			}
		}, "json");
		return false;
	});
});
</script>
</body>
</html>